Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#632 - Namespace conflict with TaylorSeries.update! #667

Merged
merged 1 commit into from
Aug 14, 2019
Merged

Conversation

schillic
Copy link
Member

@schillic schillic commented Aug 13, 2019

Closes #632.

The problem here was that both ProgressMeter and TaylorSeries export update!, so we had to use import instead of using for one of those packages.

Since we use ProgressMeter.update! but not TaylorSeries.update!, I thought that we should use import TaylorSeries and explicitly add the functions from TaylorSeries that we use.
While trying this, I discovered an issue with Requires which I want to share here.

TaylorSeries also exports normalize_taylor, but that function only becomes visible after loading IntervalArithmetic via Requires. This can be seen as follows:

julia> using TaylorSeries

julia> normalize_taylor
ERROR: UndefVarError: normalize_taylor not defined

julia> import IntervalArithmetic
        
julia> normalize_taylor
normalize_taylor (generic function with 4 methods)

So I tried the following in Reachability:

julia> import IntervalArithmetic, TaylorSeries

julia> using TaylorSeries: normalize_taylor, ...

While this works perfectly in the REPL, loading this from within a module crashes in the precompilation. The reason is that Requires defers the loading to a queue and processes that queue only after the current command. Since "the current command" here is "precompile the module", the precompilation must finish before the extra code is loaded. And this means that TaylorSeries.normalize_taylor is not visible at that time. (This can be tested by adding a print output to the @require command in TaylorSeries.)

So I ended up with import ProgressMeter and writing ProgressMeter.update! everywhere. Note that ultimately there is no way around this and using MyPackage is only a convenience functionality to avoid spelling out the package in most cases.

@schillic schillic requested a review from mforets August 14, 2019 07:55
@schillic schillic changed the title WIP #632 - Namespace conflict with TaylorSeries.update! #632 - Namespace conflict with TaylorSeries.update! Aug 14, 2019
@mforets
Copy link
Member

mforets commented Aug 14, 2019

Got it, thanks a lot for the in-depth explanation.

@schillic schillic merged commit 24ce76a into master Aug 14, 2019
@schillic schillic deleted the schillic/632 branch August 14, 2019 18:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Namespace conflict with TaylorSeries.update!
2 participants